<template>
  <div class="app-container">
    <router-link :to="{name:'feedback_list',query:{feedbckId:this.$route.query.feedbackId }}">
      <el-button type="primary">返回</el-button>
    </router-link>
    <div class="info">
      <div>处理状态：{{feedbackInfo.status == 1?$t('feedback.Unprocessed'):$t('feedback.Processed')}}</div>
      <div>用户手机号：{{feedbackInfo.usersPhone}}</div>
      <!-- <div>手机号/邮箱：{{feedbackInfo.usersPhone}}</div> -->
      <div>反馈时间：{{feedbackInfo.ctime}}</div>
      <div>反馈内容：{{feedbackInfo.context || $t('feedback.No_feedback')}}</div>
      <!-- <div>意见类型：{{feedbackInfo.feedbackType == 1?'设备问题':feedbackInfo.feedbackType == 2?'支付问题':'其他问题'}}</div> -->
      <div>
        {{$t('feedback.Picture')}}：
        <img v-for="(item,index) in imgList" :key='index' :src="item" style="width:300px;max-height:600px;">
      </div>
    </div>
    <router-link :to="{name:'feedback_list',query:{feedbackId:feedbackId}}" v-if="feedbackInfo.status==1">
      <el-button @click="handle" type="primary" style="margin-left:100px;margin-top:50px;">{{$t('feedback.deal_with')}}</el-button>
    </router-link>      
  </div>
</template>
<script>
import { getFeedbackDetail,upFeedback} from '@/api/feedback'
import { parseTime } from '@/utils/index'
export default {
   name:'feedback_detail',
   data() {
     return {
       feedbackInfo:{},
       feedbackId:this.$route.query.feedbackId,
       imgList:[]
     }
   
   },
   methods:{
     //获取意见详情
     async getDetail() {
       const {data} = await getFeedbackDetail({
         feedbackId:this.feedbackId
       })
       //循环解析时间
        data.ctime = parseTime(data.ctime)
        console.log( data.ctime)
        this.feedbackInfo = data
        this.imgList =  this.feedbackInfo.feedbackUrl.split(",")
     },
     //点击处理按钮
     async handle() {
       const {data} = await upFeedback({
         feedbackId:this.feedbackId
       })
     }
   },
   created(){
     this.getDetail()
   }
}
</script>
<style lang="scss" scoped>
.info{
  margin-top:30px;
  padding-left:50px;
  color:#606266;
  div{
    line-height:50px;
  }
}
</style>
